package com.yxym.extend_.improve;

//ctrl+ H 可以看到类的继承关系
public class Sub  extends Base {//继承父类
    public Sub(){//子类无参构造器
        //super();//默认调用父类的无参构造器，编译器默认自动调用，导致父类构造器被调用
        System.out.println("子类无参构造器Sub被调用");
    }
    public Sub(String name){
        System.out.println("子类构造器Sub(String name)被调用");
    }
    public Sub(String name,int age){
        super();//调用父类的无参构造器
        //super("mm",25);
        //super(20);
        System.out.println("子类构造器Sub(String name，int age)被调用");
        //super(20);//需要放在构造器的首行
    }
    public void say() {
        System.out.println("n1 = " + n1 + "n2 = " + n2 + "n3 = " + n3);
        test100();
        test300();
        test200();
        System.out.println("n4 = " + getN4());
    }
}
